package com.cskaoyan.app.bean.common;

import com.cskaoyan.app.bean.vo.CartTotalVo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Map;

/**
 * @author stone
 * @date 2022/01/06 16:24
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BaseRespVo<T> {
    int errno;
    String errmsg;
    T data;

    public static BaseRespVo<Object> ok() {
        return new BaseRespVo<>(0, "成功", null);
    }

    public static <T> BaseRespVo<T> ok(T data) {
        return new BaseRespVo<>(0, "成功", data);
    }

    public static BaseRespVo<Object> invalidData(String msg) {
        return new BaseRespVo<>(504, msg, null);
    }
    public static BaseRespVo<Object> invalidData() {
        return new BaseRespVo<>(504, "更新数据已失效", null);
    }
    public static BaseRespVo<Object> invalidParameter(String msg) {
        return new BaseRespVo<>(400, msg, null);
    }
    public static BaseRespVo<Object> unAuthed() {
        return new BaseRespVo<>(401, "认证失败", null);
    }
}
